﻿
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO



CREATE PROCEDURE [dbo].[bhp_NemoRecordIdentChange]
	@GroupId	INT,
	@RecordId	INT,
	@Ident		NVARCHAR(400)
AS
BEGIN

	
	DECLARE @Q NVARCHAR(1000)
	
	SET @Q = 'UPDATE T' + CAST(@GroupId as NVARCHAR(10)) + ' SET identyfikator=''' + @Ident + ''', mtime=GETDATE(), muser=7000002 WHERE idx=' + CAST(@RecordId as NVARCHAR(10))
	EXEC sp_executesql @Q
	SET @Q = 'UPDATE R' + CAST(@GroupId as NVARCHAR(10)) + ' SET mtime=GETDATE(), muser=7000002 WHERE idx=' + CAST(@RecordId as NVARCHAR(10))
	EXEC sp_executesql @Q
	
	
END


GO